package cn.hesion.dataStructures.BinarySortTree;

public class BinarySortTreeDemo {

}

class Node {
    int value;
    Node right;
    Node left;

    public Node(int value) {
        this.value = value;
    }

    public Node Search(int value) {
        if(value==this.value){
            return this;
        } else  if(value < this.value){
            if(this.left == null){
                return null;
            }
            return this.left.Search(value);
        }else {
            if(this.right == null){
                return null;
            }
            return this.right.Search(value);
        }
    }

    @Override
    public String toString() {
        return "Node【" +
                "value=" + value +
                '】';
    }
}

